package com.newland.zxy.config;

import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author : zhangxuyuan
 * @Project: springcloudoauth2
 * @Package com.newland.zxy.config
 * @date Date : 2021年02月05日 14:48
 */
@Component
public class MyTokenConverter extends DefaultAccessTokenConverter {
    @Override
    public OAuth2Authentication extractAuthentication(Map<String, ?> map) {

        OAuth2Authentication oAuth2Authentication = super.extractAuthentication(map);
        oAuth2Authentication.setDetails(map);

        return oAuth2Authentication;
    }
}
